package interview;

import java.util.Arrays;

public class interview_10_11 {
    public void wiggleSort(int[] nums) {
        Arrays.sort(nums);
        int[] nums2=nums.clone();
        int left=0;
        int right=nums.length-1;
        int index=0;
        while(left<right){
            nums[index]=nums2[right];
            index++;
            right--;
            nums[index]=nums2[left];
            index++;
            left++;
        }
        if(left==right){
            nums[index]=nums2[left];
        }

    }
}
